package cn.wgx.module.sys.web;

import cn.wgx.common.base.IBaseController;
import cn.wgx.common.entity.ent.Enterprise;
import cn.wgx.common.entity.sys.SysApp;
import cn.wgx.common.util.ResponseDataUtil;
import cn.wgx.module.sys.service.AppService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Api(tags = "4.0 App应用管理")
@RestController
@RequestMapping("/api/sysApp")
public class AppCtrl extends IBaseController<AppService, SysApp> {

    @ApiOperation(value = "查询未授权应用的企业,分页查询(page第几页, limit每页数量,默认20)",notes = "必填：app_id")
    @GetMapping("listEntNotInApp")
    public Map listAppNotInEnt(@RequestParam Integer app_id,
                               @RequestParam(required = false, defaultValue = "1") Integer page,
                               @RequestParam(required = false, defaultValue = "20") Integer limit) {
        Page<Enterprise> page1 = new Page(page, limit);
        return ResponseDataUtil.returnData(page1, service.getEntNotInApp(page1, app_id));
    }
}
